package com.onpositive.datacollection.editor;

import java.io.File;

import com.onpositive.semantic.model.api.status.CodeAndMessage;
import com.onpositive.semantic.model.api.validation.IValidationContext;
import com.onpositive.semantic.model.api.validation.IValidator;

public class FileValidator implements IValidator<String>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public CodeAndMessage isValid(IValidationContext context, String value) {
		if (value==null||!new File(value).exists()){
			return CodeAndMessage.errorMessage("Please select existing data collection");
		}
		return CodeAndMessage.OK_MESSAGE;
	}

}
